"use strict";
cc._RF.push(module, 'f09d5xDiRJEHq0Dt4Tascl2', 'ToolsHelper');
// scripts/ToolsHelper.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = function () {
  function e() {}

  return e.getChild = function (e, t) {
    for (var o = t.split("/"), a = e, n = 0; n < o.length; n++) {
      if (!a) return null;
      a = a.getChildByName(o[n]);
    }

    return a;
  }, e.moveNode = function (e, t, o) {
    if (void 0 === o && (o = !1), !e || !t) return null;
    var a = e.parent;

    if (cc.isValid(a)) {
      if (o) for (var n = a.children, i = !0, r = 0; r < n.length; r++) {
        var s = n[r];
        (i && s.zIndex > e.zIndex || !i) && (s.zIndex += e.zIndex + 1), s == e && (i = !1);
      }

      var l = e.getPosition(),
          _ = a.convertToWorldSpaceAR(l),
          c = t.convertToNodeSpaceAR(_);

      e.removeFromParent(!1), e.parent = t, e.position = c;
    }

    return a;
  }, e.nodeConvertToNodeSpaceAR = function (e, t, o) {
    void 0 === o && (o = cc.Vec2.ZERO);
    var a = e.convertToWorldSpaceAR(o);
    return t.convertToNodeSpaceAR(a);
  }, e.c3bToHex = function (e, t, o) {
    return new cc.Color(), "number" == typeof e ? new cc.Color(e, t, o).toHEX("#rrggbb") : e.toHEX("rrggbb");
  }, e.getStorageItem = function () {
    var e = arguments[0],
        t = arguments[1],
        o = cc.sys.localStorage.getItem(e);
    return null == o && null != t && (o = t), o;
  }, e.setStorageItem = function () {
    var e = arguments[0],
        t = arguments[1];
    return cc.sys.localStorage.setItem(e, t), t;
  }, e.getAngle = function (e, t) {
    var o = this.GetRadian(e, t);
    return 180 / Math.PI * o;
  }, e.GetRadian = function (e, t) {
    var o = e.x - t.x,
        a = t.y - e.y;
    return Math.atan2(a, o);
  }, e.pLineIntersect = function (e, t, o, a, n) {
    if (e.x === t.x && e.y === t.y || o.x === a.x && o.y === a.y) return !1;

    var i = t.x - e.x,
        r = t.y - e.y,
        s = a.x - o.x,
        l = a.y - o.y,
        _ = e.x - o.x,
        c = e.y - o.y,
        d = l * i - s * r;

    return n.x = s * c - l * _, n.y = i * c - r * _, 0 === d ? 0 === n.x || 0 === n.y : (n.x = n.x / d, n.y = n.y / d, !0);
  }, e;
}();

o["default"] = a;

cc._RF.pop();